package ursaminor.lazywork.common.core;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;

import ursaminor.lazywork.common.constant.GlobalConstants;
import ursaminor.lazywork.platform.model.Account;

public class BaseController {	

	protected static Logger log = Logger.getLogger(BaseController.class.getName());
	
	public BaseController() {
		
	}

	public void init(HttpServletRequest req) {

	}
	
	public Account getCurrentAccount(HttpServletRequest req) {
		Account currAcc = null;
		if (req.getSession(false) == null) return currAcc; 
		Object obj = ContextContainer.getValue(req.getSession(false).getId(), GlobalConstants.CURR_ACC_INFO);
		if (obj instanceof Account) {
			currAcc = (Account)obj;
		} else {
			currAcc = null;
		}
		return currAcc;
	}
	
}